#!/bin/bash

if [[ ! $# == 1 ]];
  then 
  echo usage: $0 /localperl/install/path
  exit
fi

localperl_install=$1

if [[ -f $localperl_install/bin/perl ]]; 
  then 
    echo "local perl exists. don't want to overwrite it"
    echo "suggest backing up $localperl_install, moving or removing,"
    echo "and running this again"
    exit
fi


  ( 
    [[ ! -f perl-5.8.8.tar.gz ]] && wget http://search.cpan.org/CPAN/authors/id/N/NW/NWCLARK/perl-5.8.8.tar.gz
    rm -rf perl-5.8.8
    tar -xzvf perl-5.8.8.tar.gz
    cd perl-5.8.8
    sh Configure -Dprefix=$localperl_install -des #make this your home directory
    make test
    make install
  ) | tee perlinstall.out

